<template>
  <cu-layout :bgStyle="{ color: '#ffffff' }" :navProp="{ placeholder: true }">
    <view :class="[`${prefixCls}-house-container`]">
      <view class="setting-row">
        <view class="left"> 管家推荐意向询问 </view>
        <view class="right"> <uv-switch v-model="value" :activeColor="theme" inactive-color="#f3f4f6"></uv-switch> </view>
      </view>
      <view class="text">我们将根据你的找房行为，弹窗询问您是否允许管家为你推荐房源服务，若关闭，将不再询问。</view>
      <view class="setting-row">
        <view class="left"> 允许管家推荐 </view>
        <view class="right"> <uv-switch v-model="value" :activeColor="theme" inactive-color="#f3f4f6"></uv-switch> </view>
      </view>
      <view class="text">
        {{ remark }}
      </view>
    </view>
  </cu-layout>
</template>

<script>
import { mapActions, mapGetters } from 'vuex'
import { configGet } from './api'
export default {
  name: 'house',
  components: {},
  mixins: [],
  props: {},
  data() {
    return {
      value: true,
      remark:
        '我们可能基于您的搜索、筛选、浏览、收藏、提交找房单信息向您推荐房源。由门店管家电话联系或添加您的微信与您取得联系，为你推荐符合您需求的房源。关闭后，您将无法体验管家的专属服务，但不影响您使用找房功能。',
    }
  },
  // 侦听属性
  watch: {},
  // 计算属性
  computed: {
    ...mapGetters(['theme']),
  },
  // 监听页面加载，该钩子被调用时data,computed,function,watch,props,slots已设置完成
  onLoad(options) {
    this.configGet()
  },
  // 监听页面显示，页面每次出现在屏幕上都触发
  onShow() {},
  // 监听页面初次渲染完成，此时组件已挂载完成
  onReady() {},
  // 下拉刷新
  onPullDownRefresh() {},
  // 加载更多
  onReachBottom() {},

  created() {},
  mounted() {},
  destroyed() {},
  methods: {
    ...mapActions([]),
    async configGet() {
      const { data } = await configGet({ configKey: 'AllowUserRecommend' })
      this.value = data.value
      this.remark = data.remark
    },
  },
}
</script>

<style lang="scss" scoped>
page {
  background: white !important;
}
.#{prefixCls('house-container')} {
  position: relative;
  background: white;
  box-sizing: border-box;
  padding: 15px;
  .setting-row {
    display: flex;
    justify-content: space-between;
    padding: 15px 0;
    .right {
      display: flex;
    }
  }
}
</style>
